<template>
    <div class="movies">
        <MoviesTem v-for="(item,index) in moviesData" :key="index" :item="item" :index='index'></MoviesTem>
    </div>
</template>
<script>
import MoviesTem from "../movies-template/movies_tem.vue"
import {mapState} from "vuex"
import listData from '../../data/list-data'
const MOVIE_URL = 'http://t.yushu.im/v2/movie/top250'
// const MOVIE_URL = 'https://api.douban.com'
export default {
    data(){
        return {
            moviesData:[]
        }
    },
    components:{
        MoviesTem
    },
    computed:{
        ...mapState(['movie_tmp'])
    },
    beforeMount(){
       this.$store.dispatch('getDataMovies');
       //发送请求得到数据
       this.$fly.get(MOVIE_URL).then(res=>{
        //    console.log(res);
           this.moviesData = res.data.subjects
           this.$store.dispatch("getMovieDetail",res.data.subjects)
       }).catch(res=>{
           console.log(res);
       })

    // wx.request({
    //     url:MOVIE_URL,
    //     success(res){
    //         console.log(res);
    //     }
    // })
    },
    mounted(){
    },
    beforeUpdate(){
        //  wx.startPullDownRefresh({
        //     success(){
        //         console.log(77888888);
        //     }
        // })
    }
}
</script>

<style scoped>

</style>


